home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / ccmd / tzone.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-19  |  3.6 KB  |  93 lines

  1. /*
  2.  Author: Andrew Lowry
  3.  
  4.  Columbia University Center for Computing Activities, July 1986.
  5.  Copyright (C) 1986, 1987, Trustees of Columbia University in the City
  6.  of New York.  Permission is granted to any individual or institution
  7.  to use, copy, or redistribute this software so long as it is not sold
  8.  for profit, provided this copyright notice is retained.
  9. */
  10.  
  11. /* Macros to calculate julian dates from normal dates.  0 = Jan 1,
  12. ** February assumed to have 29 days */
  13.  
  14. #define JAN(x)    ((x)-1)
  15. #define    FEB(x)    ((x)+30)
  16. #define    MAR(x)    ((x)+59)
  17. #define APR(x)    ((x)+90)
  18. #define    MAY(x)    ((x)+120)
  19. #define    JUN(x)    ((x)+151)
  20. #define    JUL(x)    ((x)+181)
  21. #define    AUG(x)    ((x)+212)
  22. #define    SEP(x)    ((x)+243)
  23. #define OCT(x)    ((x)+273)
  24. #define    NOV(x)    ((x)+304)
  25. #define    DEC(x)    ((x)+334)
  26.  
  27.  
  28. /* Time zone information... First, all the rules we know about -
  29. ** This was mostly taken from BSD 4.2 sources and TOP-20 V5 sources.
  30. ** The rules are not always accurate, and are frequently inaccurate in
  31. ** isolated areas (e.g. states which have exempted themselves from
  32. ** daylight savings time).  Modify these tables as required.
  33. */
  34.  
  35. static dstrule usarule[] = {        /* USA rules (by 1967 legislation) */
  36.   { 1974, 1974, JAN(6), NOV(30) },    /* 74: Jan 6 -> end Nov */
  37.   { 1975, 1975, FEB(28), OCT(31) },    /* 75: end Feb -> end Oct */
  38.   { 1987, 3000, APR(2), OCT(31) },    /* 1987, DST on Apr 2. */
  39.   { 0,    1986,    APR(30), OCT(31) },    /* --> 1987: end Apr -> end Oct */
  40. };
  41.  
  42. static dstrule ausrule[] = {        /* Australia (reverse table) */
  43.   { 1970, 1970, JAN(1), DEC(50) },    /* 70: no dst at all */
  44.   { 1971, 1971, JAN(1), OCT(31) },    /* 71: end Oct -> */
  45.   { 1972, 1972, FEB(29), OCT(31) },    /* 72: -> end Feb, end Oct -> */
  46.   { 0,      3000, MAR(7), OCT(31) }    /* others: -> beg Mar, end Oct -> */
  47. };
  48.  
  49. /* European tables, believed correct for:
  50. **   Western: Great Britain, Ireland, Portugal
  51. **   Middle:  Belgium, Luxembourg, Netherlands, Denmark, Norway, Austria,
  52. **          Poland, Czechoslovakia, Sweden, Switzerland, DDR, DBR, France,
  53. **          Spain, Hungary, Italy, Jugoslavia
  54. **   Eastern: Bulgaria, Finland, Greece, Rumania, Turkey, Western Russia
  55. ** Eastern Europe gets Middle European dst rules, since our source (BSD 4.2)
  56. ** claimed ignorance and followed this strategy.
  57. **/
  58.  
  59. static dstrule werule[] = {
  60.   { 1983, 3000, MAR(31), OCT(30) },    /* After 83: end Mar -> end Oct */
  61.   { 0,    1982, DEC(50), DEC(50) }    /* Before 83: No dst */
  62. };
  63.  
  64. static dstrule merule[] = {
  65.   { 1983, 3000, MAR(31), SEP(30) },    /* After 83: end Mar -> end Sep */
  66.   { 0,    1982, DEC(50), DEC(50) }    /* Before 83: No dst */
  67. };
  68.  
  69.  
  70. /* Timezone information table */
  71.  
  72. static tzinf tzinfo[] = {
  73.   { TZ_GMT,  "GMT", "GMT",       0*60, werule,  60, FALSE },
  74.   { TZ_UAST, "AST", "ADT",       4*60, usarule, 60, FALSE },
  75.   { TZ_UEST, "EST", "EDT",       5*60, usarule, 60, FALSE },
  76.   { TZ_UCST, "CST", "CDT",       6*60, usarule, 60, FALSE },
  77.   { TZ_UMST, "MST", "MDT",       7*60, usarule, 60, FALSE },
  78.   { TZ_UPST, "PST", "PDT",       8*60, usarule, 60, FALSE },
  79.   { TZ_UYST, "YST", "YDT",       9*60, usarule, 60, FALSE },
  80.   { TZ_UHST, "HST", "HDT",      10*60, usarule, 60, FALSE },
  81.   { TZ_UBST, "BST", "BDT",      11*60, usarule, 60, FALSE },
  82.   { TZ_EWET, "WET", "WET DST",   0*60, werule,  60, FALSE },
  83.   { TZ_EMET, "MET", "MET DST",  -1*60, merule,  60, FALSE },
  84.   { TZ_EEET, "EET", "EET DST",  -2*60, merule,  60, FALSE },
  85.   { TZ_AEST, "EST", "EST",     -10*60, ausrule, 60, TRUE },
  86.   { TZ_ACST, "CST", "CST", -(9*60+30), ausrule, 60, TRUE },
  87.   { TZ_AWST, "WST", "WST",      -8*60, ausrule, 60, TRUE }
  88. };
  89.  
  90. /* macro giving number of timezones represented in the table */
  91. #define TZCOUNT    (sizeof(tzinfo) / sizeof(tzinf))
  92.  
  93.